home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / demos / mastdemo.zoo / batch / mail.bat < prev    next >
DOS Batch File  |  1990-03-22  |  945b  |  39 lines

  1. # simple 'mailmerge' with Master V5.6
  2. if "$1" = "" {
  3.     beep
  4.     rem Usage: $0 letter
  5.     quit 1
  6. }
  7.  
  8. Letter = "$1"
  9. WORDENTITY = ","            ;# words are seperated by commas
  10.  
  11. # structure of the data file
  12. # 1. line contains the names of the variables to be substituted
  13. # all other lines have the respective values at the same position
  14. open data $Letter.dat
  15. getline varnames
  16.  
  17. rem > $Letter.prn
  18.  
  19. repeat
  20.     # initialisation of the variables for the next letter
  21.     getline values data        ;# read values
  22.     vars = "$varnames"        ;# variablenames into vars
  23.     foreach var in vars        ;# for every variable
  24.         nextitem values $var    ;# assign next value
  25.     endfor
  26.  
  27.     # now we read the letter line by line and print it
  28.     open letter $Letter.txt
  29.     repeat
  30.         getline text
  31.         rem $text >> $Letter.prn
  32.     until eof letter
  33.     close letter
  34.  
  35.     # start the next letter on a new page
  36.     rem   >> $Letter.prn
  37. until eof data                ;# until we have processed all data
  38. close data
  39.